package it.polimi.TravelDream.web.beans;

import it.polimi.TravelDream.ejb.dtos.AddressDTO;
import it.polimi.TravelDream.ejb.dtos.UserDTO;
import it.polimi.TravelDream.ejb.eaos.UserMgr;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;


@ManagedBean(name="UserMgr")
@RequestScoped
public class UserBean {
	@EJB
	private UserMgr userMgr;
	public UserDTO currentUser = new UserDTO();
	public AddressDTO currentAddress = new AddressDTO();
	
	public String getUserAndAddress() {
		currentUser = userMgr.getUserDTO();
		currentAddress = userMgr.getAddressDTO();
		return "mio profilo.xhtml?faces-redirect=true";
	}

	public UserDTO getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(UserDTO currentUser) {
		this.currentUser = currentUser;
	}

	public AddressDTO getCurrentAddress() {
		return currentAddress;
	}

	public void setCurrentAddress(AddressDTO currentAddress) {
		this.currentAddress = currentAddress;
	}
	
}
